#!/bin/bash
# read our configuration
source /boot/config/plugins/controlrd/controlrd.cfg

prog="/usr/local/emhttp/plugins/controlrd/controlrd"

# stop it if it's running
killall controlrd >/dev/null 2>&1

# run the app
[[ $UPS = "enable" ]] && SHOWUPS="--show-ups" || SHOWUPS=""
nohup sudo -H bash -c "$prog $SHOWUPS" >/dev/null 2>&1 &
